package com.qf.controller;

import com.qf.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("/json")
public class JsonController {
    @RequestMapping("/add")
    public String add(@RequestBody User user){
        System.out.println(user);
        return "success";
    }
    @RequestMapping("/findAll")
    public User findAll(){
        User user = new User();
        user.setId(1);
        user.setUsername("wangwu");
        user.setPassword("123");
        user.setBirthday(new Date());
        user.setSex("男");
        user.setMoney(5.0);
        return user;
    }
}
